
#include "CTestBarOperations.h"


CPPUNIT_TEST_SUITE_REGISTRATION(CTestBarOperations);


void CTestBarOperations::setUp(void)
{
    testObj = new CBarOperations();
}


void CTestBarOperations::tearDown(void)
{
    delete testObj;
}


void CTestBarOperations::testConstructor(void)
{
    CPPUNIT_FAIL("TODO: not yet implemented");
}


void CTestBarOperations::testAdd(void)
{
    CPPUNIT_ASSERT_EQUAL(10, testObj->add(5, 5));
    CPPUNIT_ASSERT_EQUAL(15, testObj->add(5, 10));
    CPPUNIT_ASSERT_EQUAL(-1, testObj->add(600, -601));
    CPPUNIT_ASSERT_EQUAL(-200, testObj->add(-205, 5));
    CPPUNIT_ASSERT_EQUAL(-30, testObj->add(-15, -15));
}


void CTestBarOperations::testSubtract(void)
{
    CPPUNIT_ASSERT_EQUAL(0, testObj->subtract(5, 5));
    CPPUNIT_ASSERT_EQUAL(5, testObj->subtract(20, 15));
    CPPUNIT_ASSERT_EQUAL(-400, testObj->subtract(-355, 45));
    CPPUNIT_ASSERT_EQUAL(170, testObj->subtract(90, -80));
    CPPUNIT_ASSERT_EQUAL(-115, testObj->subtract(-135, -20));
}
